/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.niedziela12.pai.ejb.user.endpoints;

import com.niedziela12.pai.ejb.dto.RoleDTO;
import com.niedziela12.pai.ejb.dto.UserDTO;
import com.niedziela12.pai.ejb.dto.UserRolesDTO;
import com.niedziela12.pai.ejb.user.managers.UserManagerLocal;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

/**
 *
 * @author Kamil
 */
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class UserEndpoint implements UserEndpointLocal {

    @EJB
    private UserManagerLocal userManager;

    @Override
    public void addNewUser(UserDTO user) {
        userManager.addNewUser(user);
    }

    @Override
    public void updateUserInfo(UserDTO user) {
        userManager.updateUserInfo(user);
    }

    @Override
    public void deleteUser(UserDTO user) {
        userManager.deleteUser(user);
    }

    @Override
    public List<UserDTO> getUsers(int from, int to) {
        return userManager.getUsers(from, to);
    }

    @Override
    public List<UserDTO> getAllUsers() {
        return userManager.getAllUsers();
    }

    @Override
    public int getUsersCount() {
        return userManager.getUsersCount();
    }

    @Override
    public UserDTO getUser(Long id) {
        return userManager.getUser(id);
    }

    @Override
    public UserDTO getUserByLogin(String login) {
        return userManager.getUserByLogin(login);
    }

    @Override
    public List<UserRolesDTO> getUsersRoles(UserDTO user) {
        return userManager.getUsersRoles(user);
    }

    @Override
    public void updateUserRoles(List<UserRolesDTO> roleList) {
        userManager.updateUsersRoles(roleList);
    }

    @Override
    public List<RoleDTO> findRolesDef() {
        return userManager.findRolesDef();
    }
    
}
